<%@page import="com.railway.news.model.*" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/commons/taglibs.jsp" %>
<html>
<head>
	<title><%=NewsColums.TABLE_ALIAS%>编辑</title>
	<link type="text/css" rel="stylesheet" href="${ctx}/css/themes/default/easyui.css">
	<link type="text/css" rel="stylesheet" href="${ctx}/css/themes/icon.css">
	<link type="text/css" rel="stylesheet" href="${ctx}/css/default.css" />
	
	<link rel="stylesheet" href="${ctx}/css/ztree.css" type="text/css">
	<link rel="stylesheet" href="${ctx}/css/zTreeStyle/zTreeStyle.css" type="text/css">	
	<script type="text/javascript" src="${ctx}/scripts/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="${ctx}/scripts/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="${ctx}/scripts/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="${ctx}/scripts/xheditor-1.1.12-zh-cn.min.js"></script>		
	<script type="text/javascript" src="${ctx}/scripts/jquery.ztree.core-3.0.min.js"></script>
	<script type="text/javascript" src="${ctx}/scripts/jquery.ztree.excheck-3.0.min.js"></script>
	
	<script type="text/javascript"  src="${ctx}/scripts/edit.js"></script>
	<SCRIPT type="text/javascript">

		var setting = {
			check: {
				enable: true,
				chkStyle: "radio",
				radioType: "all"
			},
			view: {
				dblClickExpand: false
			},
			data: {
				simpleData: {
					enable: true
				}
			},
			callback: {
				onClick: onClick,
				onCheck: onCheck
			}
		};	

		function onClick(e, treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("treeDemo");
			zTree.checkNode(treeNode, !treeNode.checked, null, true);
			return false;
		}

		function onCheck(e, treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
			nodes = zTree.getCheckedNodes(true),
			v = "";
			for (var i=0, l=nodes.length; i<l; i++) {
			    form1.catId.value += nodes[i].id;
				v += nodes[i].name + ",";

			}
			if (v.length > 0 ) v = v.substring(0, v.length-1);
			var cityObj = $("#citySel");
			cityObj.attr("value", v);
		}

		function showMenu() {
			var cityObj = $("#citySel");
			var cityOffset = $("#citySel").offset();
			$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");

			$("body").bind("mousedown", onBodyDown);
		}
		function hideMenu() {
			$("#menuContent").fadeOut("fast");
			$("body").unbind("mousedown", onBodyDown);
		}
		function onBodyDown(event) {
			if (!(event.target.id == "menuBtn" || event.target.id == "citySel" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
				hideMenu();
			}
		}

		$(document).ready(function(){

              $.get("${ctx}/news/News/getNewsById.do", {
                Action:"get",id:form1.id.value}, function (data, textStatus){			
	            var objs = eval("["+data+"]");	                    
                if(objs[0].context == undefined){        
                   return;
                }
               
                 message.document.body.innerHTML = objs[0].context;

				});	      	
		
		    $.get("${ctx}/news/Category/getCategoryList.do", {
                Action:"get",Name:"user01"}, function (data, textStatus){			
	
                var zNodes = eval(data);

		          $.fn.zTree.init($("#treeDemo"), setting, zNodes);
				});	
			
		});
		//-->
	</SCRIPT>
</head>
<body>
	<form id="form1" action="${ctx}/news/News/update.do" method="post">
	   <input type="submit" value="提交"  />
		<input type="button" value="返回列表" onclick="window.location='${ctx}${requestScope.returnUrl}'"/>
		<input type="button" value="后退" onclick="history.back();"/>
			<input type="hidden" name="fileImg" value=""/>
			<input type="hidden" name="newsImg" value=""/>
			<input id="dtitle" name="dtitle" value="${model.title}" type="hidden"/>
		    <table class="formTable">
			<input type="hidden" id="id" name="id" value="${model.id}"/>
		    <input id="returnUrl" name="returnUrl" value="${requestScope.returnUrl}" type="hidden"/>
		<!-- ONGL access static field: @package.class@field or @vs@field -->				
			<tr>	
				<td class="tdLabel">					
				</td>	
				<td>
				<input id="catId" name="catId" value="${model.catId}"
				type="hidden"  class="easyui-validatebox"   />
				</td>
			</tr>			
			<tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_TITLE%>:
				</td>	
				<td>
				<input id="title" name="title" value="${model.title}"
				type="text"  class="easyui-validatebox"   />
				</td>
			</tr>
			<tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_CREATE_TIME%>:
				</td>	
				<td>
				<input value="${model.createTimeString}" id="createTimeString" name="createTimeString"  
				type="text" class="easyui-datebox"   />
				</td>
			</tr>
			
			
			<tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_CONTENT_TEXT%>:
				</td>	
				<td>
		<TABLE border=0 cellSpacing=0 cellPadding=0 width="100%">
							<TBODY>
								<TR>
									<TD colSpan=2>
										<DIV style="BACKGROUND-COLOR: #f2f6fb" id=HtmlEditor_Toolbars>
											<DIV style="WIDTH: 574px; HEIGHT: 26px">
												&nbsp;
												<SPAN><IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('Justifyleft', '')" alt=左对齐
														src="${ctx}/images/editor/Aleft.gif"> </SPAN>&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('JustifyCenter', '')" border=0 alt=居中
														src="${ctx}/images/editor/Acenter.gif"> </SPAN>&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('JustifyRight', '')" alt=右对齐
														src="${ctx}/images/editor/Aright.gif"> </SPAN>&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('InsertUnorderedList', '')" border=0
														alt=项目符号 src="${ctx}/images/editor/list.gif"> </SPAN>&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('insertorderedlist', '')" border=0
														alt=编号 src="${ctx}/images/editor/num.gif"> </SPAN>&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('Outdent', '')" alt=回退
														src="${ctx}/images/editor/outdent.gif"> </SPAN>&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('indent', '')" border=0 alt=缩进
														src="${ctx}/images/editor/indent.gif"> </SPAN>&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('createLink')" border=0 alt=超级链接
														src="${ctx}/images/editor/url.gif"> </SPAN>&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('unLink')" border=0 alt=取消超级链接
														src="${ctx}/images/editor/nourl.gif"> </SPAN>&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('InsertHorizontalRule', '')" border=0
														alt=普通水平线 src="${ctx}/images/editor/line.gif"> </SPAN>&nbsp;
												<SPAN></SPAN>
											</DIV>
											<DIV style="HEIGHT: 26px">
												&nbsp;
												<SPAN><IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('selectall')" border=0 alt=全部选择
														src="${ctx}/images/editor/selectall.gif"> </SPAN>&nbsp;&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="ShowMenu('font',50)" border=0 alt=字体
														src="${ctx}/images/editor/font.gif"> </SPAN>&nbsp;&nbsp;&nbsp;&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="ShowMenu('fontsize',230)" border=0 alt=字体大小
														src="${ctx}/images/editor/fontsize.gif"> </SPAN>&nbsp;&nbsp;
											
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('bold', '')" alt=粗体
														src="${ctx}/images/editor/bold.gif"> </SPAN>&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('italic', '')" alt=斜体
														src="${ctx}/images/editor/italic.gif"> </SPAN>&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('underline', '')" alt=下划线
														src="${ctx}/images/editor/underline.gif"> </SPAN>&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('superscript')" border=0 alt=上标
														src="${ctx}/images/editor/sup.gif"> </SPAN>&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('subscript')" border=0 alt=下标
														src="${ctx}/images/editor/sub.gif"> </SPAN>&nbsp;
												<SPAN> <IMG style="CURSOR: hand"
														onmouseover="this.style.background='#A9A9FA'"
														onmouseout="this.style.background=''"
														onclick="FormatText('RemoveFormat')" border=0 alt=删除文字格式
														src="${ctx}/images/editor/clear.gif"> </SPAN>&nbsp;
										
											<SPAN></SPAN>
											</DIV>
											<DIV
												style="Z-INDEX: 1000; POSITION: absolute; BACKGROUND-COLOR: #b9cbf7; WIDTH: 1px; HEIGHT: 1px; VISIBILITY: hidden"
												id=menuDiv></DIV>
										</DIV>
										<IFRAME
											style="BORDER-BOTTOM: gray 0px solid; BORDER-LEFT: gray 1px solid; BORDER-TOP: gray 1px solid; BORDER-RIGHT: gray 1px solid"
											id=message height=250 marginHeight=0
											src="${ctx}/admin/news/news/content.html" frameBorder=0 width="100%"
											marginWidth=0>
										</IFRAME>
									</TD>
								</TR>
								<TR style="BACKGROUND: #dcdcdc">
									<TD style="WIDTH: 80%; HEIGHT: 23px">
										<TABLE border=0 cellSpacing=0 cellPadding=0 width="100%">
											<TBODY>
												<TR>
													<TD style="WIDTH: 40px" id=HtmlEditor_Design
														class=HtmlEditor_On
														onclick="if (HtmlEditor_codeState) {WBTB_setMode();}">
														<IMG alt=设计 src="${ctx}/images/editor/modeedit.gif">
													</TD>
													<TD style="WIDTH: 40px" id=HtmlEditor_Html
														class=HtmlEditor_Off
														onclick="if (!HtmlEditor_codeState) {WBTB_setMode();}">
														<IMG alt=代码 src="${ctx}/images/editor/modecode.gif">
													</TD>
													<!-- TD style="WIDTH: 40px" id=HtmlEditor_View
														class=HtmlEditor_Off onclick="WBTB_View('UTF-8');">
														<IMG alt=预览 src="${ctx}/images/editor/modepreview.gif">
													</TD-->
													<TD>
														&nbsp;提示:回车换行请用[Shift]+[Enter]
													</TD>
													<TD>
														&nbsp;
													</TD>
												</TR>
											</TBODY>
										</TABLE>
									</TD>
									<TD style="WIDTH: 20%">
										<A style="FONT-SIZE: 15pt" title="内容框增大"
											onclick="document.getElementById('message').height=parseInt(document.getElementById('message').height)+290"
											href="http://10.78.103.132/bjdcoa/bm/News.aspx#"><IMG
												style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px"
												alt="" src="${ctx}/images/editor/jia.gif" width=20 height=20>
										</A> &nbsp;&nbsp;
										<A style="FONT-SIZE: 15pt" title=内容框减小
											onclick="if(parseInt(document.getElementById('message').height)>(300+85)){document.getElementById('message').height=parseInt(document.getElementById('message').height)-300}"
											href="http://10.78.103.132/bjdcoa/bm/News.aspx#"><IMG
												style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px"
												alt="" src="${ctx}/images/editor/jian.gif" width=20
												height=20>
										</A>
									</TD>
								</TR>
							</TBODY>
						</TABLE>
						<INPUT id="contentText" name="contentText" value="" type="hidden"/>
						<SCRIPT language=javascript type=text/javascript>
   						 	function setContent() {
      					  		if(HtmlEditor_codeState==true){
          						  		WBTB_setMode();
        					  	}
        						document.getElementById("contentText").value = message.document.body.innerHTML ;
            				}
			 					HtmlEditor_InitDocument("contentText", "UTF-8");
						</SCRIPT>
					</TD>
				</TR>
				</TBODY>
			</TABLE>
			</td>				
			</tr>	
			<tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_FROM_NAME%>:
				</td>	
				<td>
				<input id="fromName" name="fromName" value="${model.fromName}"
				type="text"  class="easyui-validatebox"   />
				</td>
			</tr>
			
			
			<tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_FROM_URL%>:
				</td>	
				<td>
				<input id="fromUrl" name="fromUrl" value="${model.fromUrl}"
				type="text"  class="easyui-validatebox"   />
				</td>
			</tr>
			
			
			<!--tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_BROWSE%>:
				</td>	
				<td>
				<input id="browse" name="browse" value="${model.browse}"
				type="text"  class="easyui-validatebox"   />
				</td>
			</tr>
			
			
			<tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_RECOM%>:
				</td>	
				<td>
				<input id="recom" name="recom" value="${model.recom}"
				type="text"  class="easyui-validatebox"   />
				</td>
			</tr>
			
			
			<tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_TOP_STATE%>:
				</td>	
				<td>
				<input id="topState" name="topState" value="${model.topState}"
				type="text"  class="easyui-validatebox"   />
				</td>
			</tr-->
			
			
			<tr>
				<td class="tdLabel">
					<%=NewsColums.ALIAS_STATE%>:
				</td>
				<td>
					<input id="state" name="state" value="${model.state}" type="text"
						class="easyui-validatebox" />
				</td>
			</tr>
			</table>
		</form>
		<c:if test="${model.catId!='69a90eb3f8b2434eb9727a163394c53f'}">
		<Iframe src="${ctx}/news/News/showNewsImg.do"  width="250"
			height="200" scrolling="no" frameborder="0"></iframe><br>
					<Iframe src="${ctx}/news/News/showNewsHeadImg.do"  width="250"
			height="200" scrolling="no" frameborder="0"></iframe>
        </c:if>
		</table>

	
</body>
<script>
//begin $(document).ready(handler)
$(function(){

$('#form1').submit(function(){
setContent();
 form1.fromUrl.value = form1.fileImg.value; 
  form1.dtitle.value = form1.newsImg.value; 
});}
);//end $(document).ready(handler)
</script>
</html>

